using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;

namespace bowlingkata.tests
{
    [TestFixture]
    public class test_Frame
    {
        [Test]
        public void Fill_with_regular_rolls()
        {
            var sut = new Frame();

            sut.AddRoll(2);
            sut.AddRoll(3);

            Assert.AreEqual(2, sut[0]);
            Assert.AreEqual(3, sut[1]);
        }

        [Test]
        public void Only_one_roll_added_to_frame()
        {
            var sut = new Frame();

            sut.AddRoll(2);

            Assert.AreEqual(2, sut[0]);
            Assert.AreEqual(0, sut[1]);
        }

        [Test]
        public void Adding_points_to_frame()
        {
            var sut = new Frame();

            Assert.AreEqual(0, sut.Score);

            sut.AddPoints(2);
            Assert.AreEqual(2, sut.Score);

            sut.AddPoints(7);
            Assert.AreEqual(9, sut.Score);
        }

        [Test]
        public void Check_for_strike()
        {
            var sut = new Frame();

            Assert.IsFalse(sut.IsStrike);

            sut.AddRoll(10);
            Assert.IsTrue(sut.IsStrike);

            sut = new Frame();
            sut.AddRoll(0);
            sut.AddRoll(10);
            Assert.IsFalse(sut.IsStrike);
        }

        [Test]
        public void Check_for_spare()
        {
            var sut = new Frame();

            Assert.IsFalse(sut.IsSpare);

            sut.AddRoll(2);
            Assert.IsFalse(sut.IsSpare);

            sut.AddRoll(8);
            Assert.IsTrue(sut.IsSpare);

            sut = new Frame();
            sut.AddRoll(10);
            Assert.IsFalse(sut.IsSpare);
        }

    }
}